* Author: Joe Tatarka
* Name: 2_master.do
* Purpose: Run all of the .do files for the replication package
* Note: Need to run 1_1_merge_visits_and_spend.ipynb before this

* Set Global File Paths [INSERT YOUR PACKAGE PATH HERE]
global root = "/service_industries/replication_package"

global raw_root = "${root}/datasets/raw"
global intermediate_root = "${root}/datasets/intermediate"
global built_root = "${root}/datasets/built"
global exhibits_root = "${root}/exhibits"

* Paths to raw data outside of replication package  [INSERT PATH TO BUILT FILES HERE]
global homebase_root = "/project/fagoolsb/service_industries/data/datasets/raw/homebase"
global gws_root = "/project/fagoolsb/generally_useful_datasets/gws_06_17_24_pull/clean"

* Set Paths to .do files
global code_root = "${root}/code"
global code_built_root = "${code_root}/builds"
global code_exhibits_root = "${code_root}/exhibits"

*******************************************************************************
*** Run .do files
********************************************************************************

**** Cleaning Code
**** 1. Run 1_2_main_build.do
**** This cleans the merged SafeGraph Spend and Visits Data to create main_build.dta
do "${code_built_root}/1_main_build/1_2_main_build.do"

**** 2. Run 2_1_aggregates_build.do
**** Merge SafeGraph data with Census Retail Sales to create aggregates_build.dta
do "${code_built_root}/2_aggregates_build/2_1_aggregates_build.do"

**** 3. Run 3_1_gws_build.do
**** Create panel from raw GWS Magnify data 
do "${code_built_root}/3_gws_build/3_1_gws_build.do"

**** 4. Run 3_2_gws_build.do
**** Clean app events from raw GWS Magnify data 
do "${code_built_root}/3_gws_build/3_2_gws_build.do"

**** 5. Run 3_3_gws_build.do
**** Combine GWS Magnify panel with app event data to create gws_build.dta
do "${code_built_root}/3_gws_build/3_3_gws_build.do"

**** 6. Run 4_1_homebase_build.do
**** Clean Homebase data to create homebase_build.dta
do "${code_built_root}/4_homebase_build/4_1_homebase_build.do"

**** 7. Run 5_1_cap_build.do
**** Clean BEA Fixed Assets and Merge with BLS Employment data to create cap_build.dta
do "${code_built_root}/5_assets_build/5_1_cap_build.do"

**** Analysis Code
**** 8. Run 1_tables_and_figures.do
**** Create all tables and figures for the paper
do "${code_exhibits_root}/1_tables_and_figures.do"

**** 9. Run 2_additional_analysis.do
**** Create additional statistics referenced in the paper
do "${code_exhibits_root}/2_additional_analysis.do"

